﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

namespace Hyunhdai_Saigon_Project
{
    public partial class Tim_Kiem : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            String hx = Request.QueryString["hx"];
            lblHangXe.Text = getNameHangXe(int.Parse(hx));
            //if (hx.Equals("1"))
            //    lblHangXe.Text = "Huyndai";
            //else if (hx.Equals("2"))
            //    lblHangXe.Text = "Isuzu";
            //else if (hx.Equals("3"))
            //    lblHangXe.Text = "Volkswagen";
            //else
            //    lblHangXe.Text = "Tất cả hãng xe";
        }

        public String getNameHangXe(int id)
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["hyundaisaigonConnectionString"].ConnectionString);
            connection.Open();
            string sql = "select name from nhasanxuat where id = " + (id.ToString()) ;
            SqlDataAdapter da = new SqlDataAdapter(sql, connection);
            DataTable dt = new DataTable();
            da.Fill(dt);
            String result = dt.Rows[0][0].ToString();
            connection.Close();
            return result;

        }
     
    }
}